#ifndef GLOBJECT_H_
#define GLOBJECT_H_

#include <GL/glew.h>
#include <glm/glm.hpp>
#include <list>
#include "GLShaderConfig.h"

class GLObject {
protected:
	GLShaderConfig* shaderConfig;

	GLuint programHandler;

	// Handlers
	GLuint* vboHandlers;

	// Handle to the vertex array object
	GLuint vaoHandler;

	GLuint textureId;

	glm::mat4 transformMatrix;

	float colorR;
	float colorG;
	float colorB;

	bool useDiffuseTexture;
	bool useDirtTexture;

	void changeObjectColor(float r, float g, float b);

	void init();
	virtual void render(glm::mat4 viewMatrix, glm::mat4 modelMatrix) = 0;

public:
	GLObject(GLuint programHandler, GLShaderConfig shaderConfig);
	virtual ~GLObject();

	virtual void update(glm::mat4 viewMatrix, glm::mat4 modelMatrix) {};
	void setColor(float r, float g, float b);
	void loadAndInitTexture(const char* filename);
	void transform(glm::mat4 transformMatrix);
	GLShaderConfig* getShaderConfig() { return shaderConfig; };
	GLuint getProgramHandler() { return programHandler; };
};


#endif /* GLOBJECT_H_ */
